/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author pipo
 */
package mainGame;



public class Player extends Trainer {
    
    private int currentScore;
    
    public Player(int X , int Y , String name , int score)
    {
        super(X,Y, name);
        this.currentScore = 0;
        this.currentScore = score;

       
    }

    
    public void addPokemon(int rawPower, int rawDefense, int hitPoints, int type, int level , String name)
    {
        Pokemon n = new Pokemon(rawPower, rawDefense, hitPoints, type, level , name);
        this.pokemonList.add(n);
        
    }
    

            
    public void move(int direction)
    {
        //direction 1: left, 2:up, 3:right, 4:bottom
        //upper left is the (0,0)
        
        this.coorX = this.tryMoveXCoor(direction);
        this.coorY = this.tryMoveYCoor(direction);
        
        
    }
    
    public int tryMoveXCoor(int direction )
    {
        if(direction == 1)
        {
            return (this.coorX - 1);
        } 
        else if(direction == 3)
        {
            return (this.coorX + 1);
        }
        else
            return this.coorX;
    }
    
    public int tryMoveYCoor(int direction)
    {
        if(direction == 2)
        {
            return (this.coorY - 1);
        } 
        else if(direction == 4)
        {
            return (this.coorY + 1);
        }
        else
            return this.coorY;
        
    }
    
        
    
    public void reduceExperience()
    {
        
        for(Pokemon p : this.pokemonList)
        {
            p.reduceExperience();
            
        }
        
        
    }
    
    public Pokemon returnPokemon(String name)
    {
        for(Pokemon p: this.pokemonList)
        {
            if(p.getName().equals(name))
                return p;
            
        }
        return null;
        
        
    }
    
    public void addScore(int score)
    {
        this.currentScore += score;
    }
    
    public int getScore()
    {
        return this.currentScore; 
    }   
            

    
}
